package com.yummy.dto;

import org.springframework.format.annotation.DateTimeFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class QueryOrderVo {
	int currentPage;

	int pageSize;

	String orderNumber;


	Date[] orderDate;

	int storeId;

	public QueryOrderVo() {
	}


	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(String orderNumber) {
		this.orderNumber = orderNumber;
	}

	public Date[] getOrderDate() {

		return orderDate;
	}

	public void setOrderDate(String[] orderDate) throws ParseException {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
		if (orderDate == null || orderDate.length != 2) {
			this.orderDate = null;
			return;
		}
		Date[] dates = new Date[2];
		for (int i = 0; i < orderDate.length; i++) {
			dates[i] = format.parse(orderDate[i]);
		}
		this.orderDate = dates;
	}

	public int getStoreId() {
		return storeId;
	}

	public void setStoreId(int storeId) {
		this.storeId = storeId;
	}

	@Override
	public String toString() {
		return "QueryOrderVo{" +
				"currentPage=" + currentPage +
				", pageSize=" + pageSize +
				", orderNumber=" + orderNumber +
				", orderDate=" + orderDate +
				", storeId=" + storeId +
				'}';
	}
}
